package wortubung.core;

import wortubung.WortUbungException;
import wortubung.util.CommonUtils;

public enum NounCategory {

	// Human life
	ANAT ("Anatomy"),
    FOOD ("Food"),
    WEAR ("Wears"),
    LIVG ("Living"),

    // Human creation
    HUMN ("Humanity"),     // anthropology, archaeology, ecology, psychology
    SOCL ("Social"),       // Social relations, political
    CULT ("Culture"),      // philosophy, rhetoric, arts, music, sports, games, entertainments
    TECH ("Technology"),
    ARCH ("Architecture"), // architecture, construction
    FACL ("Facility"),     // facility, institution
    FINN ("Financial"),    // economics, financial, accounting, business
    MYTH ("Mythical"),     // mythology, superstition
    RELG ("Religion"),     // religion, theology
    MILI ("Military"),
    HIST ("History"),

    // Natural
    MEDC ("Medical"),      // medicine, pharmacology
    BIOL ("Biological"),   // bacteriology, biochemistry, biology, pathology, physiology
    ZOOL ("Zoology"),
    BOTN ("Botany"),
    NATR ("Nature"),       // chemistry, physics, crystallography
    GEOX ("Geo-Astro"),    // astronomy, geography, geology, meteorology
    ABST ("Abstract"),     // abstract, general concepts, mathematics, geometry
    OBJT ("Object"),       // objects
    ATTR ("Attribute"),    // (visible) attribute, such as shape, location, color, 

    // Derivation
    ACTN ("Action"),       // from verbs
    SENS ("Senses"),       // from adjectives
    STAT ("State"),        // from adjectives

    NONE ("(uncategorized)");

    private String name;

    NounCategory(String name) {
        this.name = name;
    }

    public String getName() { return name; }
    
    public static NounCategory from(String name) {
    	try {
    		if (CommonUtils.isNotEmpty(name))
    			return valueOf(name.toUpperCase());
    	} catch(Exception e) {
    		throw new WortUbungException("Noun-category '" + name + "' is not recognized.");
    	}
    	return null;
    }
}
